def find_by_sid(table,sid):
   for name,sid1 in a:
       if sid1 == sid:
           print((name,sid1))
           

find_by_sid(a,1002)
('李四', 1002)